<template>
  <div class="bottom">
    <!-- 播放信息 -->
    <div class="play-info" v-if="count != -1">
      <div class="left" @click="playAll">
        <i class="iconfont icon-bofang"></i>
        <div class="play-all">
          播放全部<span>(共{{ data.length }}首)</span>
        </div>
      </div>
      <div class="right" v-if="count != 0">
        <i class="iconfont icon-tianjia"></i>
        收藏({{ count }})
      </div>
    </div>
    <!-- 歌曲列表 -->
    <ul class="music-list">
      <li
        v-for="(item, index) in data"
        :key="item.id"
        @click="playMusic(item.id)"
        @touchstart="songFly"
      >
        <span>{{ index + 1 }}</span>
        <div class="music-info">
          <div class="t1">{{ item.name }}</div>
          <div class="t2">
            <span v-html="item.ar.map(item=>item.name).join(' / ')"></span>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import {getCurrentInstance,ref} from 'vue'
export default {
  name:'music-list',
  props:['data','count'],
  setup(props){
    let {proxy} =getCurrentInstance()
    // let data=props.data
    function playMusic(ids){
      proxy.$api.home.getMusicDetail({ids}).then(res=>{})
    }
    return {playMusic}
  }
};
</script>
<style lang="less" scoped>
.music-fly {
  position: absolute;
  top: 0;
  left: 50px;
}
</style>
<style lang="less" scoped>
.bottom {
  padding-bottom: 60px;
  background: #fff;
  border-radius: 7px;
  .play-info {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid @border-color;
    .left {
      margin-left: 5px;
      display: flex;
      align-items: center;
      i {
        font-size: 20px;
      }
      .play-all {
        font-size: 16px;
        margin-left: 10px;
        span {
          font-size: 12px;
          color: @font-color-desc-v2;
          margin-left: 5px;
        }
      }
    }
    .right {
      height: 100%;
      background: @theme-color;
      padding: 0 30px 0 10px;
      border-radius: 3px;
      display: flex;
      align-items: center;
      color: @font-color-light;
      font-size: 14px;
      i {
        font-size: 14px;
        margin-right: 5px;
      }
    }
  }
  .music-list {
    li {
      height: 60px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      span {
        width: 60px;
        text-align: center;
        font-size: 16px;
      }
      .music-info {
        flex: 1;
        height: 60px;
        padding: 5px 0;
        box-sizing: border-box;
        border-bottom: 1px solid @border-color;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        .t1,
        .t2 {
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          width: 320px;
        }
        .t1 {
          font-size: 16px;
        }
        .t2 {
          font-size: 12px;
          span {
            font-size: 12px;
          }
          color: @font-color-desc-v2;
        }
      }
    }
  }
}
</style>
